/**
 * Copyright(c) 2014 Xunton Solutions
 *
 * History:
 *   15-11-16 上午8:11 Created by dwzhang
 */
package com.jade.modules.message.mail.impl;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * 采用用户名和密码的认证器。
 *
 * @author <a href="mailto:dwzhang@xunton.com">dwzhang</a> 
 * @version 1.0 15-11-16 上午8:11
 */
public class SimpleAuthenticator extends Authenticator
{
    private String username;
    private String password;

    public SimpleAuthenticator(String username, String password)
    {
        this.username = username;
        this.password = password;
    }

    public String getUsername()
    {
        return username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication()
    {
        return new PasswordAuthentication(username, password);
    }
}
